package com.minimalist.common.feign.client.lindi;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.priceconfig.LindiPriceConfigQueryVO;
import com.minimalist.common.entity.lindi.vo.priceconfig.LindiPriceConfigVO;
import com.minimalist.common.feign.config.FeignConfig;
import com.minimalist.common.feign.fallback.lindi.LindiPriceConfigFeignClientFallbackFactory;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.constraints.NotNull;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 林地价格配置 Feign 客户端
 *
 * @author minimalist
 */
@FeignClient(name = "minimalist-lindi"
        , contextId = "lindiPriceConfigFeignClient"
        , path = "/minimalist/lindi/priceConfig"
        , configuration = FeignConfig.class
        , fallbackFactory = LindiPriceConfigFeignClientFallbackFactory.class)
public interface LindiPriceConfigFeignClient {

    /**
     * 添加价格配置
     *
     * @param priceConfigVO 价格配置信息
     * @return 响应结果
     */
    @PostMapping("/addPriceConfig")
    @Operation(summary = "添加价格配置")
    R<?> addPriceConfig(@RequestBody @Validated(Add.class) LindiPriceConfigVO priceConfigVO);

    /**
     * 修改价格配置
     *
     * @param priceConfigVO 价格配置信息
     * @return 响应结果
     */
    @PutMapping("/updatePriceConfigByPriceConfigId")
    @Operation(summary = "修改价格配置")
    R<?> updatePriceConfigByPriceConfigId(@RequestBody @Validated(Update.class) LindiPriceConfigVO priceConfigVO);

    /**
     * 删除价格配置
     *
     * @param priceConfigId 价格配置ID
     * @return 响应结果
     */
    @DeleteMapping("/deletePriceConfigByPriceConfigId")
    @Operation(summary = "删除价格配置 -> 根据价格配置ID删除")
    R<?> deletePriceConfigByPriceConfigId(
            @RequestParam("priceConfigId")
            @NotNull(message = "价格配置ID不能为空")
            @Parameter(name = "priceConfigId", required = true, description = "价格配置ID")
            Long priceConfigId);

    /**
     * 获取价格配置详情
     *
     * @param priceConfigId 价格配置ID
     * @return 价格配置详情
     */
    @GetMapping("/getPriceConfigByPriceConfigId/{priceConfigId}")
    @Operation(summary = "根据价格配置ID查询价格配置")
    R<LindiPriceConfigVO> getPriceConfigByPriceConfigId(
            @PathVariable("priceConfigId")
            @NotNull(message = "价格配置ID不能为空")
            @Parameter(name = "priceConfigId", description = "价格配置ID", required = true)
            Long priceConfigId);

    /**
     * 分页查询价格配置列表
     *
     * @param queryVO 查询条件
     * @return 价格配置列表
     */
    @GetMapping("/getPagePriceConfigList")
    @Operation(summary = "查询价格配置列表(分页)")
    R<PageResp<LindiPriceConfigVO>> getPagePriceConfigList(@RequestBody LindiPriceConfigQueryVO queryVO);
}